import request from '@/utils/request'
import {
  Cycle,
  IHeaderInfo,
  IJNotice,
  IOrderCycleChartData,
  IUserChartData,
  Menu
} from './types/home'

export const getMenus = () => {
  return request<Menu[]>({
    method: 'GET',
    url: '/menusList'
  })
}

export const getJNotice = () => {
  return request<IJNotice[]>({
    method: 'GET',
    url: '/jnotice'
  })
}

export const getHeaderInfo = () => {
  return request<{ info: IHeaderInfo[] }>({
    method: 'GET',
    url: '/home/header'
  })
}

export const getOrderChartDataByCycle = (cycle: Cycle) => {
  return request<IOrderCycleChartData>({
    method: 'GET',
    url: `/home/order?cycle=${cycle}`
  })
}

export const getUserChartData = () => {
  return request<IUserChartData>({
    method: 'GET',
    url: '/home/user'
  })
}
